package com.xbongbong.saas.model;

import com.xbongbong.paas.domain.entity.PaasStageEntity;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.pro.opportunity.pojo.vo.SaleStageModifyLogVO;
import com.xbongbong.saas.domain.entity.SaleStageModifyLogEntity;
import com.xbongbong.saas.domain.entity.StageWorkEntity;

import java.util.List;
import java.util.Map;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/13 11:05
 * @since v1.0
 */
public interface SaleStageModifyLogModel extends IModel<SaleStageModifyLogEntity> {

    @Override
    List<SaleStageModifyLogEntity> findEntitys(Map<String, Object> param);

    SaleStageModifyLogEntity getByKey(Long key, String corpid);

    Integer save(SaleStageModifyLogEntity saleStageModifyLogEntity) throws XbbException;

    void insertBatch(List<SaleStageModifyLogEntity> list);

    Integer deleteBatch(List<SaleStageModifyLogEntity> saleStageModifyLogList, String corpid);

    SaleStageModifyLogVO getNeedSyncStageIdList(String corpid, Long formId, Long stageProcessId);

    /**
     * 编辑销售阶段时保存阶段比例的变更记录
     *
     * @param corpid          公司id
     * @param formId          表单id
     * @param stageProcessId  阶段流程id
     * @param businessType    业务类型
     * @param updateStageList 编辑后的阶段数据
     */
    void saveModifyLogWhenUpdateStage(String corpid, Long formId, Long stageProcessId, Integer businessType, List<PaasStageEntity> updateStageList) throws XbbException;

    /**
     * 编辑销售阶段任务时保存阶段任务占比的变更记录
     *
     * @param businessType      业务类型
     * @param currentStageWork  编辑后的阶段任务
     * @param originalStageWork 编辑前的阶段任务
     */
    void saveModifyLogWhenUpdateStageWork(Integer businessType, StageWorkEntity currentStageWork, StageWorkEntity originalStageWork) throws XbbException;

    /**
     * 删除销售阶段任务时保存变更记录
     *
     * @param businessType     业务类型
     * @param currentStageWork 删除的任务
     */
    void saveModifyLogWhenDeleteStageWork(Integer businessType, StageWorkEntity currentStageWork) throws XbbException;
}
